/**
 * 给定N个区间[L, R]，要求分别从每个区间中取出一个数，使得总和为0。
 * 贪心
 * 首先遍历一遍，对有零的区间就取0，对正区间取最小值，负区间取最大值
 * 得到一个sum，如果sum为零，则可行
 * 
 * 然后再for一遍每个区间：
 *    如果当前sum大于零，则需要将当前数向小了选
 *       如果当前是正区间，则不操作，且以后也无需操作
 *       否则，按需移动，或者最大移动即可
 *    如果当前sum小于零，同理
 * 
 */
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;

using llt = long long;
using vi = vector<int>;
using vll = vector<llt>;

template<typename T>
void input(vector<T> & v, int n){
    v.assign(n, {});
    for(int i=1;i<=n;++i) cin >> v[i];
    return;
}

template<typename T>
istream & operator >> (istream & is, vector<T> & v){
    for(auto & i : v) is >> v;
    return is;
}

using pll = pair<llt, llt>;

int N;
vector<pll> A;
vll Ans;

bool proc(){
    Ans.assign(N, 0);
    llt sum = 0;
    for(int i=0;i<N;++i){
        auto [a, b] = A[i];
        if(b < 0) Ans[i] = b;
        else if(a > 0) Ans[i] = a;
        else Ans[i] = 0;
        sum += Ans[i];
    }
    if(0 == sum) return true;
    for(int i=0;i<N;++i){
        auto [a, b] = A[i];
        if(sum > 0){
            if(b < 0){
                auto could = a - b;
                if(sum + could > 0){
                    Ans[i] = a;
                    sum += could;
                }else{
                    Ans[i] += -sum;
                    sum = 0;
                    return true;
                }
            }else if(a > 0){

            }else{
                assert(Ans[i] == 0);
                if(sum + a > 0){
                    Ans[i] = a;
                    sum += a;
                }else{
                    Ans[i] = -sum;
                    sum = 0;
                    return true;
                }
            }
        }else if(sum < 0){
            if(a > 0){
                auto could = b - a;
                if(sum + could < 0){
                    Ans[i] = b;
                    sum += could;
                }else{
                    Ans[i] += -sum;
                    sum = 0;
                    return true;
                }
            }else if(b < 0){

            }else{
                assert(Ans[i] == 0);
                if(sum + b < 0){
                    Ans[i] = b;
                    sum += b;
                }else{
                    Ans[i] = -sum;
                    sum = 0;
                    return true;
                }
            }
        }
    }
    return false;
}

void work(){
    cin >> N;
    A.assign(N, {});
    for(auto & p : A) cin >> p.first >> p.second;

    bool flag = proc();
    if(not flag) return (void)(cout << "No\n");
    cout << "Yes\n";
    for(auto i : Ans) cout << i << " ";
    cout << endl;
    return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int nofkase = 1;
    // cin >> nofkase;
    while(nofkase--) work();
    return 0;
}